package edu.sias.course.mapper;




import edu.sias.course.domain.dto.CatalogDTO;
import edu.sias.course.domain.entity.CatalogPageQueryParams;
import edu.sias.course.domain.pojo.Catalog;

import edu.sias.course.domain.vo.CatalogVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Description CatalogMapper
 * @Author songyu
 * @Date 2023-08-30
 */
@Mapper
public interface CatalogMapper {

    /**
     * 根据courseId查询学科目录数量
     * @param courseId
     * @returnccc
     */
    @Select("select count(*) from course_catalog where course_id = #{courseId}")
    Integer selectCountCatalogById(Integer courseId);

    /**
     * 添加学科目录
     * @param catalog
     */

    void add(Catalog catalog);

    /**
     * 根据条件查询学科目录
     * @param queryParams
     * @return
     */
    List<CatalogVO> findByCondition(CatalogPageQueryParams queryParams);

    /**
     * 删除学科目录
     * @param id
     */
    @Delete("delete from course_catalog where id = #{id}")
    void delete(Integer id);

    /**
     * 根据学科id查询学科目录列表数据
     * @param courseId
     * @return
     */
    @Select("select * from course_catalog where course_id = #{courseId}")
    List<Catalog> findListByCourseId(Integer courseId);

    /**
     * 更新学科目录
     * @param catalog
     */
    void update(Catalog catalog);

@Select("select * from course_catalog where id = #{catalogId}")
    CatalogDTO findById(Integer catalogId);
}
